package com.ephics.ui
{
	import flash.display.Sprite;
	import flash.events.MouseEvent;
	
	/**
	 *@author	yigitkula
	 *@project	BaseButton.as
	 *@date		Oct 29, 2011
	 */
	
	public class BaseButton extends Sprite
	{
		public function BaseButton()
		{
			enable();
		}
		
		public function enable():void
		{
			this.mouseChildren = false;
			this.mouseEnabled = true;
			this.buttonMode = true;
			addEventListener(MouseEvent.ROLL_OVER, onMouseOver);
			addEventListener(MouseEvent.ROLL_OUT, onMouseOut);
			addEventListener(MouseEvent.CLICK, onMouseClick);
		}
		
		public function disable():void
		{
			this.mouseChildren = false;
			this.mouseEnabled = false;
			this.buttonMode = false;
			removeEventListener(MouseEvent.ROLL_OVER, onMouseOver);
			removeEventListener(MouseEvent.ROLL_OUT, onMouseOut);
			removeEventListener(MouseEvent.CLICK, onMouseClick);
		}
		
		public function unload():void
		{
			disable();
			while(numChildren)
			{
				removeChildAt(0);
			}
			
			if(this.parent)
				this.parent.removeChild(this);
		}
		
		protected function onMouseOver(event:MouseEvent):void
		{
			
		}
		
		protected function onMouseOut(event:MouseEvent):void
		{
			
		}
		
		protected function onMouseClick(event:MouseEvent):void
		{
			
		}
	}
}